﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization;

namespace Meow.Core;

public static class MeowPath
{
    public readonly static string DefaultAssetPath = Path.Combine(".", "Asset");
    public readonly static string DefaultMeshPath = Path.Combine(DefaultAssetPath, "Mesh");
    public readonly static string DefaultTexturePath = Path.Combine(DefaultAssetPath, "Texture");
    public readonly static string DefaultShaderPath = Path.Combine(DefaultAssetPath, "Shader");

}

public abstract class Def
{
    public virtual bool Save(string path)
    {
        try
        {
            var serializer = new SerializerBuilder()
    .WithNamingConvention(CamelCaseNamingConvention.Instance)
    .Build();
            var yaml = serializer.Serialize(this);
            File.WriteAllText(path, yaml);
            return true;
        }
        catch (Exception ex) 
        { 
            Logger.Error(this.GetType().ToString() + " Def Save: " + ex.ToString());
            return false;
        }
    }
}
public abstract class MeowRes
{
    public abstract bool Save(string path);
}
